
import React, { useState, useEffect } from 'react';
import { Spin, Tabs } from 'antd';
import useComponentLoaded from '../hooks/useComponentLoaded';

const App = () => {
    const [isLoading, setIsLoading] = useState(true);
    const [count, setCount] = useState(0);
    useComponentLoaded('Test');

    useEffect(() => {
        console.log("首次执行了");
        
        const timer = setTimeout(() => {
            setIsLoading(false);
        }, 1000);

        return () => clearTimeout(timer);
    }, []);
    
    
    const tabs = [
        {
          label: 'Tab 1',
          key: '1',
          children: (
            <h3>Tab 1111</h3>
          ),
        },
        {
          label: 'Tab 2',
          key: '2',
          children: 'Tab 2222',
          disabled: false,
        },
        {
          label: 'Tab 3',
          key: '3',
          children: 'Tab 3333',
        },
      ]

      return (
        <>
            {
                isLoading ? <Spin fullscreen  size="large" tip="Loading..." /> : <Tabs defaultActiveKey="1" items={tabs} />
            }
            
        </>
      )
       
      
}

export default App;